<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- QCtmFile.cpp -->
  <title>QCtmFile Class | QCustomUi 1.10.0</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li><a href="index.html">QCustomUi 1.10.0</a></li>
<li><a href="index.html">QCustomUi</a></li>
<li>QCtmFile</li>
<li id="buildversion">QCustomUi 1.10.0 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3 id="toc">Contents</h3>
<ul>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QCtmFile Class</h1>
<!-- $$$QCtmFile-brief -->
<p>文件操作类，提供文件读写的便捷方法. <a href="#details">More...</a></p>
<!-- @@@QCtmFile -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">  <span class="preprocessor">#include &lt;QCtmFile.h&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="https://doc.qt.io/qt/qfile.html">QFile</a></td></tr></table></div>
<ul>
<li><a href="qctmfile-members.html">List of all members, including inherited members</a></li>
</ul>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> std::optional&lt;QByteArray&gt; </td><td class="memItemRight bottomAlign"><b><a href="qctmfile.html#load">load</a></b>(const QString &amp;<i>file</i>, QIODevice::OpenMode <i>mode</i> = QIODevice::ReadOnly)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qctmfile.html#save">save</a></b>(const QString &amp;<i>file</i>, const QByteArray &amp;<i>content</i>, QIODevice::OpenMode <i>mode</i> = QIODevice::WriteOnly)</td></tr>
</table></div>
<!-- $$$QCtmFile-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
</div>
<!-- @@@QCtmFile -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$load[overload1]$$$loadconstQString&QIODevice::OpenMode -->
<h3 class="fn" id="load"><code>[static] </code><span class="type">std::optional</span>&lt;<span class="type">QByteArray</span>&gt; QCtmFile::<span class="name">load</span>(const <span class="type"><a href="https://doc.qt.io/qt/qstring.html">QString</a></span> &amp;<i>file</i>, <span class="type"><a href="https://doc.qt.io/qt/qiodevicebase.html#OpenModeFlag-enum">QIODevice::OpenMode</a></span> <i>mode</i> = QIODevice::ReadOnly)</h3>
<p>加载文件 <i>file</i>, 可设置文件打开模式 <i>mode</i>, 如果读取文件失败返回 std::nullopt，读取成功返回文件内容.</p>
<p><b>See also </b><a href="qctmfile.html#save">save</a>.</p>
<!-- @@@load -->
<!-- $$$save[overload1]$$$saveconstQString&constQByteArray&QIODevice::OpenMode -->
<h3 class="fn" id="save"><code>[static] </code><span class="type">bool</span> QCtmFile::<span class="name">save</span>(const <span class="type"><a href="https://doc.qt.io/qt/qstring.html">QString</a></span> &amp;<i>file</i>, const <span class="type">QByteArray</span> &amp;<i>content</i>, <span class="type"><a href="https://doc.qt.io/qt/qiodevicebase.html#OpenModeFlag-enum">QIODevice::OpenMode</a></span> <i>mode</i> = QIODevice::WriteOnly)</h3>
<p>保存内容 <i>content</i> 到文件 <i>file</i> 中，可设置文件打开模式 <i>mode</i>, 如果保存成功则返回true，否则返回false.</p>
<p><b>See also </b><a href="qctmfile.html#load">load</a>.</p>
<!-- @@@save -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> QCustomUi
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/> </div>
</body>
</html>
